﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;
using System.Web.UI.DataVisualization.Charting;
namespace IHISCETeim.Web.MachineSys.MacModel
{
    public partial class ODailyReport_GetMachineTaskTime4_GroupBySerialNumber : PageBase
    {
        protected override string DWZRef
        {
            get
            {
                return "ODailyReport";
            }
        }
        #region 属性 (查询条件)
        protected int screeWidth
        {
            get
            {
                var x = GetRequestValue<int>("screeWidth", 800);
                return x - 80;
            }
        }

        protected string WorkDateForm
        {
            get
            {
                return GetRequestValue<string>("WorkDateForm", DateTime.Now.ToString("yyyy-MM-01"));

            }
        }

        protected string WorkDateTo
        {
            get
            {
                return GetRequestValue<string>("WorkDateTo", DateTime.Now.ToString("yyyy-MM-dd"));
            }
        }

        protected string SerialNumber
        {
            get
            {
                return GetRequestValue<string>("SerialNumber", "");
            }
        }

        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            DataBind4();
        }

        protected void DataBind4()
        {
            DataTable dt = ODailyController.GetMachineTaskTime4_GroupBySerialNumber(SerialNumber);
            rpMachineTaskTimeChart4.DataSource = dt;
            rpMachineTaskTimeChart4.DataBind();
            MachineTaskTimeChart4.DataSource = dt;
            MachineTaskTimeChart4.Series["Series1"].XValueMember = "GongWei";
            MachineTaskTimeChart4.Series["Series1"].YValueMembers = "TaskTime";
            MachineTaskTimeChart4.DataBind();
            MachineTaskTimeChart4.Width = 600;
            MachineTaskTimeChart4.Titles[0].Text = string.Format(MachineTaskTimeChart4.Titles[0].Text,SerialNumber);
            //double tasktimes = 0;
            //foreach (DataRow dr in dt.Rows)
            //{
            //    tasktimes = tasktimes + Convert.ToDouble(dr["TaskTime"]);
            //}

            //MachineTaskTimeChart.Titles["TaskTimeTitle"].Text = string.Format("从{0}到{1}总直接工时为{2}分钟", WorkDateForm, WorkDateTo, tasktimes);
        }
    }
}